package com.totoro.author.filter;

import java.io.IOException ;

import javax.servlet.Filter ;
import javax.servlet.FilterChain ;
import javax.servlet.ServletException ;
import javax.servlet.http.HttpServletRequest ;
import javax.servlet.http.HttpServletResponse ;

import org.springframework.web.filter.OncePerRequestFilter ;


/**
 * 校验权限的filter
 * @author 80002165 @date 2017年8月2日 上午10:23:46
 */
public class IdentifyAuthorFilter extends OncePerRequestFilter implements Filter {

    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
        String author = (String) request.getAttribute("author") ;
        author = request.getParameter("author") ;
        request.getSession().setAttribute("author", author);
        filterChain.doFilter(request, response);
    }
    
}
